package com.hexacta.hrs.test.data;

import java.util.List;
import java.util.Map;

import org.vectrics.history.ActivityType;

/**
 * Test data dependency creator for the ActivityType class.
 * 
 * @author tpollak
 */
public class ActivityTypeTestDataDependencyCreator extends AbstractTestDataDependencyCreator {

    public ActivityTypeTestDataDependencyCreator(List<TestDataDependencyCreator> dependencies) {
        super(dependencies);
    }

    public void createDependentTestData(Map<String, Object> context) {
        this.createAndInsertActivityType("company_create", "Created company");
        this.createAndInsertActivityType("company_update", "Updated Company");
        this.createAndInsertActivityType("company_void", "Voided company");
        this.createAndInsertActivityType("intrv_create", "Created interview");
        this.createAndInsertActivityType("intrv_update", "Updated interview");
        this.createAndInsertActivityType("job_activate", "Activated job");
        this.createAndInsertActivityType("job_appl_create", "Created application");
        this.createAndInsertActivityType("job_appl_update", "Updated application");
        this.createAndInsertActivityType("job_create", "Created job");
        this.createAndInsertActivityType("job_deactivate", "Changed job to deactive");
        this.createAndInsertActivityType("job_update", "Changed job");
        this.createAndInsertActivityType("job_void", "Voided job");
        this.createAndInsertActivityType("person_create", "Create person");
        this.createAndInsertActivityType("person_update", "Update person");
    }

    private ActivityType createActivityType(String code, String description) {
        ActivityType activityType = new ActivityType();
        activityType.setCode(code);
        activityType.setDescription(description);
        activityType.setVoided(false);
        return activityType;
    }

    private ActivityType createAndInsertActivityType(String code, String description) {
        ActivityType activityType = this.createActivityType(code, description);
        this.insertCodedObject(activityType);
        return activityType;
    }
}
